package com.elrichuang.userserver.server;

import com.elrichuang.userserver.domain.bo.CandidateQueryBo;
import com.elrichuang.userserver.domain.vo.CandidateStatusVo;
import com.elrichuang.userserver.service.ICandidateService;
import com.elrichuang.terminator.tri.user.DubboUserServerTriple;
import com.elrichuang.terminator.tri.user.UserReply;
import com.elrichuang.terminator.tri.user.UserRequest;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class UserServerImpl extends DubboUserServerTriple.UserServerImplBase {

    @Autowired
    private ICandidateService candidateService;

    @Override
    public UserReply sayHello(UserRequest request) {
        CandidateQueryBo bo = new CandidateQueryBo();
//        bo.setKeyword(request.getName());

        CandidateStatusVo candidateStatusVo = candidateService.allStatus(bo);

        return UserReply.newBuilder().setMessage("user " + candidateStatusVo.getRows().toString()).build();
    }
}
